home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Msgs / c / Report < prev   
Text File  |  1993-07-13  |  2KB  |  58 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Msgs.Report.c
  12.     Author:  Copyright © 1993 Philip Colmer
  13.     Version: 1.01 (13 Jul 1993)
  14.     Purpose: To ease reporting errors which are based on messages
  15. */
  16.  
  17. #include <stdarg.h>
  18. #include <stdio.h>
  19.  
  20. #include "DeskLib:Error.h"
  21. #include "DeskLib:Msgs.h"
  22.  
  23.  
  24. extern void Msgs_Report(int errornum, char *tag, ...)
  25. {
  26.   va_list va;
  27.   char buffer[256];
  28.   char errmess[256];
  29.  
  30.   if (!Msgs_Lookup(tag, buffer, 252))
  31.     Error_ReportInternal(0, "Cannot find message for error '%s'", tag);
  32.   else
  33.   {
  34.     va_start(va, tag);
  35.     vsprintf(errmess, buffer, va);
  36.     va_end(va);
  37.  
  38.     Error_Report(errornum, errmess);
  39.   }
  40. }
  41.  
  42.  
  43. extern void Msgs_ReportFatal(int errornum, char *tag, ...)
  44. {
  45.   va_list va;
  46.   char buffer[256];
  47.  
  48.   if (!Msgs_Lookup(tag, buffer, 252))
  49.     Error_ReportFatalInternal(0,
  50.                           "Cannot find message for fatal error '%s'", tag);
  51.   else
  52.   {
  53.     va_start(va, tag);
  54.     Error_ReportFatal(errornum, buffer, va);
  55.     va_end(va);
  56.   }
  57. }
  58.